

$(document).ready(function() {
	// getCurrStu();
    $.ajaxSetup({
        xhrFields: {withCredentials: true},
        crossDomain: true
    });
    $("input[name='stuName']").val("小红");
    $("input[name='stuInfoId']").val("20151000");
    $("input[name='stuSex']").val("女");
    $("input[name='academy']").val("华信软件学院");
    $("input[name='termYear']").val("2015-2016");
    $("input[name='termNum']").val("第一学期");
});

$(function(){
	$("#apply-btn").click(function(){
		 // var $stuName=$("input[name='stuName']").val();

	    //var $sutNum=$("input[name='sutNum']").val();

	    // var $stuSex=$("input[name='stuSex']").val();

	    // var $termYear=$("input[name='termYear']").val();

	    // var $termNum=$("input[name='termNum']").val();

	    var projectName=$("input[name='projectName']").val();
	    var projectPlatform=$("input[name='projectPlatform']").val();
	    var projectContact=$("input[name='projectContact']").val();
	    var projectPhonenum=$("input[name='projectPhonenum']").val();
	    var projectContent=$("textarea[name='projectContent']").val();
	    var startDate=$("input[name='startDate']").val();
	    var endDate=$("input[name='endDate']").val();
	    var project_state=2;

	    $.ajax({
	        url: "http://localhost:8080/xiangmu/shenQingLiXiang",
	        type: "post",
	        data:"termId="+1+"&stuInfoId="+1+"&projectName="+projectName+"&projectContent="+projectContent+"&projectPhonenum="+projectPhonenum
	        +"&projectStartDate="+startDate+"&projectEndDate="+endDate+"&projectContactPeople="+projectContact+
	        "&projectPlatform="+projectPlatform+"&projectState="+project_state+"&projectEndtDate="+endDate,
	        dataType: "text",
	        success:function (data) {
	            var msg="";
	            if(data=="true"){
	            	msg = "申请成功！请耐心等待！";
	            }
	            if(data=="false"){
	            	msg = "申请失败！什么鬼！";
	            }
	            layer.msg(msg);
	        },
	        error:function () {
	            layer.msg("网络在开小差~稍后重试");
	        }
	    });

	})
})

/*提交申请*/
//$(document).on('click', '#apply-btn', function() {
//   
//});


// function getCurrStu() {
//     $.ajax({
//         url: "http://localhost:8080/student/getCurrStu",
//         type: "get",
//         dataType: "json",
//         success:function (data) {
//             console.log("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT")
//             console.log(data)
//         },
//         error:function () {
//             layer.msg("网络在开小差~稍后重试");
//         }
//     });
//
// }


$(document).on('click','#re-btn',function () {
    $("input[name='projectName']").val("");
    $("input[name='projectPlatform']").val("");
    $("input[name='projectContact']").val("");
    $("input[name='projectPhonenum']").val("");
    $("textarea[name='projectContent']").val("");
    $("input[name='startDate']").val("");
    $("input[name='endDate']").val("");

});
